package com.cqq.boot.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.cqq.boot.dao.CommonDao;
import com.cqq.boot.domain.User;
import com.cqq.boot.mapper.UserMapper;
import com.cqq.boot.service.UserService;

@Service("userService")
public class UserServiceImpl extends CommonDao implements UserService{

    @Autowired
    private UserMapper userMapper;
    
    public User getUserById(int id) {
        return userMapper.getUserById(id);
    }
    
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,timeout=36000,rollbackFor=Exception.class)
    public int add(User user){
    	return userMapper.add(user);
    }
    
    public List<User> getUsers() {
    	return userMapper.getUsers();
    }
}